//
//  ViewController-Extension.swift
//  Chihiro
//
//  Created by point on 2016/12/7.
//  Copyright © 2016年 chihiro. All rights reserved.
//

import UIKit
import SVProgressHUD

extension UIViewController {
    
    func hudLoad(_ loadStr:String = "努力加载中...") {
        SVProgressHUD.show(withStatus: loadStr)
        SVProgressHUD.setDefaultMaskType(.black)
    }
    
    func hudHide() {
        SVProgressHUD.dismiss()
    }
    
    
    func hudLoadMessage(_ str:String) {
        SVProgressHUD.showInfo(withStatus: str)
        SVProgressHUD.dismiss(withDelay: 1.5)
    }
    
    func hudError() {
        SVProgressHUD.showError(withStatus: "请求失败！请检查网络后重试")
        SVProgressHUD.dismiss(withDelay: 1.5)
    }
    
    func configAdjustment(_ view:UIScrollView) {
        if #available(iOS 11.0, *) {
            view.contentInsetAdjustmentBehavior = .never
        }else{
            automaticallyAdjustsScrollViewInsets = false
        }
    }
}


